<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML>
<html>
<head>
<title>My JSP 'result.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link href="assets/ico/bioroad-logo.ico" rel="shortcut icon">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap-popover.js"></script>
<script type="text/javascript" src="js/bootstrap-scrollspy.js"></script>
<script type="text/javascript" src="js/bootstrap-tab.js"></script>

<style type="text/css">
.sampleInfoContainer {
	position: absolute;
	top: 0px;
	width: 700px;
	margin-top: 10px;
	margin-left: 360px;
}

.testIts {
	padding-left: 10px;
}

#timer {
	margin-top: -120px;
}
</style>
</head>
<body>
	<%@ include file="include/topbar.jsp"%>
	<%@ include file="include/leftCategory.jsp"%>
	<div class="sampleInfoContainer">
		<hr />
		<img alt="" src="img/baolude-logo.gif">
		<hr />
		<div style="font-size: 18px;font-family: 方正静蕾简体;">
		<i class="icon-home"></i>
			<a id="homepageLink" href="homepageLink.action">查询主页</a>》》》
			<i class="icon-list"></i>
			<a
				id="sampleInfoLink" href="sampleInfoLink.action">订单列表</a>》》》
				<i class="icon-book"></i>
				<a
				href="gotoSampleInfoOrderPage.action?sampleInfoSn=${sampleInfo.sn}">订单信息</a>》》》
				<i class="icon-edit"></i>
				<span>编辑订单</span>
			<hr />
		</div>
		<span style="float:right;" id="timer"></span> <i class="icon-list"></i>${sampleInfo.sourceOrder}<br />
		订单的编辑：
		<hr>
		<form action="updateSampleInfo.action" id="updateSampleForm">
			<div class="input-prepend">
				<span class="add-on"><i class="icon-qrcode"></i> 源编码</span><span
					class="input-xlarge uneditable-input">&nbsp;&nbsp;${sampleInfo.code}
				</span>
			</div>
			<div class="input-prepend">
				<span class="add-on"><i class="icon-barcode" id=""></i> 编号</span> <input
					id="prependedInput" class="span2" type="text" size="16"
					name="sampleInfo.sourceOrder" value="${sampleInfo.sourceOrder }" />
			</div>
			<div>
				测试项目：
				<c:forEach var="testItem" items="${sampleInfo.testItems}">
					<span class="testItem" style="display:inline;">
						${testItem.name} <input name="testItemHiddenSn" type="hidden"
						value="${testItem.sn}" /> <i class="icon-trash"
						id="deleteTestItem${testItem.sn}"></i> </span>&nbsp;&nbsp;&nbsp;&nbsp;
				</c:forEach>
				<input type="hidden" name="sampleInfo.price"
					value="${sampleInfo.price }" /> <input type="hidden"
					name="testItemsUpdateSn" value="" />
			</div>


			<div class="input-prepend">
				<input type="hidden" name="sampleInfoTestStatusName"
					value="${sampleInfo.testStatus.name }" /> <span class="add-on"><i
					class="icon-tag" id=""></i> 订单状态</span> <select>
					<c:forEach var="testStatus" items="${testStatusList}">
						<option value="${testStatus.name}">${testStatus.name}</option>
					</c:forEach>
				</select> <input type="hidden" name="testStatus.name" />
			</div>
			<%--<input type="button" id="myId" value="测试"/>
			--%>
			<%--不用修改的字段的隐藏域 --%>
			<input type="hidden" name="sampleInfo.amount"
				value="${sampleInfo.amount }" /> <input type="hidden"
				name="sampleInfo.remittance" value="${sampleInfo.remittance }" /> <input
				type="hidden" name="sampleInfo.code" value="${sampleInfo.code }" />
			<input type="hidden" name="sampleInfo.sn" value="${sampleInfo.sn }" />
			<input type="hidden" name="sampleInfo.issueTime"
				value="${sampleInfo.issueTime }" /> <input type="hidden"
				name="sampleInfo.id" value="${sampleInfo.id }" /> <input
				type="hidden" name="sampleInfo.clinicOrWard"
				value="${sampleInfo.clinicOrWard }" /> <input type="hidden"
				name="sampleInfo.bloodType" value="${sampleInfo.bloodType }" /> <input
				type="hidden" name="sampleInfo.specialNote"
				value="${sampleInfo.specialNote }" /> <input type="hidden"
				name="sampleInfo.sampleType" value="${sampleInfo.sampleType }" /> <input
				type="hidden" name="sampleInfo.cash" value="${sampleInfo.cash }" />
			<input type="hidden" name="sampleInfo.remitDate"
				value="${sampleInfo.remitDate }" /> <input type="hidden"
				name="sampleInfo.paperReportDate"
				value="${sampleInfo.paperReportDate }" /> <input type="hidden"
				name="sampleInfo.eReportDate" value="${sampleInfo.EReportDate }" />
			<input type="hidden" name="sampleInfo.needInvoice"
				value="${sampleInfo.needInvoice }" /> <input type="hidden"
				name="sampleInfo.invoiceDate" value="${sampleInfo.invoiceDate }" />
			<input type="hidden" name="sampleInfo.needReport"
				value="${sampleInfo.needReport }" /> <input type="hidden"
				name="sampleInfo.reportSendDate"
				name="${sampleInfo.reportSendDate }" /> <input type="hidden"
				name="sampleInfo.client" value="${sampleInfo.client }" /> <input
				type="hidden" name="sampleInfo.personInCharge"
				value="${sampleInfo.personInCharge }" /> <input type="hidden"
				name="sampleInfo.editor" value="${sampleInfo.editor }" /> <input
				type="hidden" name="sampleInfo.conclusion"
				value="${sampleInfo.conclusion }" /> <input type="hidden"
				name="sampleInfo.parent" value="${sampleInfo.parent }" /> <input
				type="hidden" name="sampleInfo.place" value="${sampleInfo.place }" />
		</form>
		<a class="btn btn-success" href="javascript:void(0)"><i class="icon-ok icon-white"></i>&nbsp;&nbsp;&nbsp;提交</a>
	</div>
</body>
<script type="text/javascript">
	function showTimer() {
		var mydate = new Date();
		var text = mydate.toLocaleString();
		var div = document.getElementById("timer");
		div.innerHTML = text;
		setTimeout("showTimer()", 1000);
	}
	window.onload = showTimer();
	$(function() {
		$("#myId").click(function() {
			alert($("input[name='testStatus.name']").val());
			$("input[name='testStatus.name']").val($("select").val());
			alert($("select").val());
			alert($("input[name='testStatus.name']").val());
		});

		$("option").each(
				function() {
					if (($(this).val().trim()) == ($(
							"input[name='sampleInfoTestStatusName']").val()
							.trim())) {
						$(this).attr("selected", "selected");
					}
				});
	});
	$(function() {
		$(".btn-success")
				.click(
						function() {
							var strForSampleInfoTestItem = "";
							$(".testItem")
									.each(
											function() {
												if ($(this).attr("style")
														.trim() == "display: inline;"
														|| $(this)
																.attr("style")
																.trim() == "display:inline;") {
													strForSampleInfoTestItem = strForSampleInfoTestItem
															+ ($(this)
																	.children(
																			"input")
																	.val() + "_");
												}
											});
							$("input[name='testItemsUpdateSn']").val(
									strForSampleInfoTestItem);
							//alert($("input[name='testItemsUpdateSn']").val());
							if ($("input[name='testItemsUpdateSn']").val()
									.trim() == ""
									|| $("input[name='testItemsUpdateSn']")
											.val().trim() == null) {
								alert("订单选项中测试项目不能为空！");
								return false;
							}
							$("input[name='testStatus.name']").val(
									$("select").val());
							//alert($("input[name='testItemsUpdateSn']").val());
							//alert($("input[name='testStatus.name']").val());
							$("#updateSampleForm").submit();
						});
		$(".testItem").each(function() {
			var testItemSn = $(this).children("input").val();
			$("#deleteTestItem" + testItemSn).click(function() {
				$(this).parent().css({
					display : "none"
				});
			});
		});
	});
</script>
</html>
